{extend name="public/base" /}
{block name="container"}
<body class="gray-bg">
  <div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
      <div class="col-sm-12">
        <div class="ibox float-e-margins">
          <div class="ibox-title">
            <h5>订单列表</h5>
            <div style="float: right;">
              <a  class="btn btn-w-m btn-info" href="{:url('index/clothes/addOrder')}">录入订单</a>
            </div>
          </div>
          <div class="ibox-content">
            <div class="row">
                           <!--  <div class="col-sm-5 m-b-xs">
                              <select class="input-sm form-control input-s-sm inline">
                                  <option value="0">选择品类</option>
                                  
                                  <option value=""></option>
                                 
                              </select>
                            </div>  -->
                            <!--<form action="" method="post">
                               <div class="col-sm-6 m-b-xs">
                               <div data-toggle="buttons" class="btn-group">
                                 <label class="btn btn-sm btn-white" style="width: 80px">
                                   <input type="radio" id="option1" name="options" style="width: 80px">待财审</label>
                                   <label class="btn btn-sm btn-white active" style="width: 80px">
                                     <input type="radio" id="option2" name="options" style="width: 80px">待审核</label>
                                     <label class="btn btn-sm btn-white" style="width: 80px">
                                       <input type="radio" id="option3" name="options" style="width: 80px">待定版</label>
                                       <label class="btn btn-sm btn-white" style="width: 80px">
                                         <input type="radio" id="option3" name="options" style="width: 80px">待下载</label>
                                         <label class="btn btn-sm btn-white" style="width: 80px">
                                           <input type="radio" id="option3" name="options" style="width: 80px">待发货</label>
                                           <label class="btn btn-sm btn-white" style="width: 80px">
                                             <input type="radio" id="option3" name="options" style="width: 80px">已驳回</label>     
                                           </div>
                                         </div> 
                                       </form> -->
                                       <form action="" method="post">
                                        <div class="col-sm-3" style="float: right;">
                                          <div class="input-group">
                                            <input type="text" placeholder="请输入产品名称或者订单号" name="name" class="input-sm form-control"> <span class="input-group-btn">
                                              <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                            </div>
                                          </div>
                                        </form>
                                      </div>
                                      <div class="table-responsive">
                                        <table class="table table-striped">
                                          <thead>
                                            <tr>

                                              <th>序号</th>
                                              <th>产品名称</th>
                                              <th>品类</th>
                                              <th>面料编号</th>
                                              <th>面料属性</th>
                                              <th>尺码</th>
                                              <th>价格</th>
                                              <th>制作数量</th>
                                              <th>订单号</th>
                                              <th>录单时间</th>
                                              <th>订单状态</th>
                                              <th>操作</th>

                                            </tr>
                                          </thead>
                                          <tbody>
                                            {volist name="list" id="vo"}
                                            <tr>
                                              <td>
                                                <!-- <input type="checkbox"  name="input" value=""> -->
                                                {$vo.id}
                                              </td>
                                              <td>{$vo.name}</td>
                                              <td>{$vo.category}</td>
                                              <td>{$vo.ml_num}</td>
                                              <td>{$vo.ml_style}</td>
                                              <td>{$vo.size}</td>
                                              <td>{$vo.price}</td>
                                              <td>{$vo.num}</td>
                                              <td>{$vo.orderid}</td>
                                              <td>{$vo.addtime|date="Y-m-d H:i",###}</td>
                                              <td>{$vo.status}</td>
                                              <td>{$vo.cao}</td>
                                            </tr>
                                            {/volist}
                                          </tbody>
                                        </table>
                                        <div style="float: right;">
                                         {$page}
                                       </div>
                                     </div>

                                   </div>
                                 </div>
                               </div>

                             </div>
                           </div>

                           <div id="modal-form" class="modal fade" aria-hidden="true">
                            <div class="modal-dialog">
                              <div class="modal-content">
                                <div class="modal-body">
                                  <div class="row">
                                    <div class="col-sm-12 b-r">
                                      <h3 class="m-t-none m-b">上传文件</h3>
                                      <form enctype="multipart/form-data" role="form" method="post" id="uploadForm" action="{:url('index/clothes/upload')}" >
                                        <div class="form-group">
                                          <input type="hidden" name="order_id" id="order_id" value="">
                                          <input type="file" name="img" value=""> 
                                          <input type="submit" value="上传" style="margin-top:20px;" >
                                        </div>
                                      </form>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>

                          <div id="modal-form_yundan" class="modal fade" aria-hidden="true">
                            <div class="modal-dialog">
                              <div class="modal-content">
                                <div class="modal-body">
                                  <div class="row">
                                    <div class="col-sm-12 b-r">
                                      <h3 class="m-t-none m-b">运单号：</h3>
                                      <form role="form" action="{:url('index/clothes/yundan')}" method="post">
                                        <div class="form-group">
                                          <input type="name" placeholder="请填入运单号" class="form-control" id="reaon" name="yundan_num">
                                          <input type="hidden" id="orderid_yun" name="orderid" value="">
                                        </div>
                                        <div>
                                          <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit"><strong>提交</strong>
                                          </button>
                                        </div>
                                      </form>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                          {/block}
                          {block name="js"}
                          <!-- Peity -->
                          <script src="__INDEX__/js/plugins/peity/jquery.peity.min.js"></script>

                          <!-- 自定义js -->
                          <script src="__INDEX__/js/content.js?v=1.0.0"></script>


                          <!-- iCheck -->
                          <script src="__INDEX__/js/plugins/iCheck/icheck.min.js"></script>

                          <!-- Peity -->
                          <script src="__INDEX__/js/demo/peity-demo.js"></script>

                          <script>
                            $(document).ready(function () {
                              $('.i-checks').iCheck({
                                checkboxClass: 'icheckbox_square-green',
                                radioClass: 'iradio_square-green',
                              });
                            });
                          </script>
                          <script>
                            function getInfo(id)
                            {
                              $.post('{url("index/clothes/uploadZip")}', {id: id}, function(data) {
                                if(data == 3){
                                 swal({
                                  title: "权限不足",
                                  text: "",
                                  type: "error"
                                });
                                $('#modal-form').css('display','none'); 
                               }
                             });
                              $("#order_id").val(id);
                              $('#orderid_yun').val(id);
                            }
                          </script>
                          <script>
        // ajax的下载文件
        function xiazai(id)
        {
            //alert(id);
            $.post('{:url("index/clothes/ajaxDownload")}', {id: id}, function(data) {
             if(data.msg == -1){
              swal({
                title: "权限不足",
                text: "",
                type: "error"
              });
            }
            if(data.msg == 1){
             window.location.href= data.url;
               //window.location.reload();
             }
           });
          }
        </script>
        <script>
          function delorder(id)
          {
            swal({   
              title: "确定要删除数据?",   
              text: "确认将删除该条数据!",   
              type: "warning",   
              showCancelButton: true,    
              confirmButtonText: "确认", 
              cancelButtonText: '取消',
              closeOnConfirm: false
            }, function(){   
              $.post('{:url("index/clothes/delorder")}', {'id':id}, function(data) {
                if(data.sta == -1 ){
                  swal({
                    title: "权限不足",
                    text: "",
                    type: "error"
                  });
                }else if(data.sta == 1){
                 swal({
                  title: "删除成功",
                  text: "",
                  type: "success"
                });
                 window.location.reload();
               }else{
                swal({
                  title: "删除失败",
                  text: "",
                  type: "error"
                });                
              }
            });
            });
          }
        </script>
      </script>
      {/block}